package com.作业.Day10;


import lombok.Data;

class service {
    /**
     * 展示
     */
    void show() {
        System.out.println("**********欢迎来到奖客富翁系统**********");
        System.out.println("          1.注册         ");
        System.out.println("          2.登录         ");
        System.out.println("          3.抽奖         ");
        System.out.println("*************************************");
        System.out.print("请选择菜单");
    }

    /**
     * 选择
     *
     * @param next
     */
    int extracted(int next) {
        switch (next) {
            case 1:
                System.out.println("奖客富翁系统>注册");
                return 1;
            case 2:
                System.out.println("奖客富翁系统>登录");
                return 2;
            case 3:
                System.out.println("奖客富翁系统>抽奖");
                return 3;
            default:
                System.out.println("输入错误");
                break;
        }
        return 0;
    }

    /**
     * 注册
     */
    boolean register(Customer customer) {
        int length1 = customer.getUserName().length();
        int passWord = customer.getPassWord().length();
        if (length1 == 6 && passWord == 6) {
            return true;
        }
        System.out.println("账号或密码必须6位数");
        return false;
    }

    /**
     * 随机数字
     */
    int ramDom() {
        int max = 9999;
        int min = 1000;
        int cardNumber = (int) ((Math.random() * (max - min)) + min);
        return cardNumber;
    }

    /**
     * @param register1
     * @param userName
     * @param passWord
     * @param service
     */
    void isRegister(boolean register1, String userName, String passWord, service service) {
        if (register1) {
            System.out.println("注册成功");
            System.out.println("用户名   密码     会员卡号");
            System.out.println(userName + "  " + passWord + "   " + service.ramDom());

        }
    }
    /**
     * 登录
     *
     */
    boolean login(Customer customer){
        if(customer.getUserName().equals("admin")&& customer.getPassWord().equals("123456")){
            System.out.println("欢迎您"+customer.getUserName());
            return true;
        }
        else
            return false;
    }
}

@Data
class Customer {
    String userName;
    String passWord;
    String card;
}